package entity

import org.joda.time.DateTime

class Sample implements Entity {
    Integer id
    ServiceRequest serviceRequest
    String name
    Float quantity
    Boolean radioactive
    Boolean magnetic
    Boolean photographicRecord
    Integer dispositionMethod
    Integer state
    String comments
    List tests = new ArrayList()
    //Custody information
    Custody storage = new Custody()
    Custody disposal = new Custody()
    Custody leftoverDisposal = new Custody()
    
    String toString() {
        "${serviceRequest.getClient().getAbbreviation()}${id.toString().padLeft(4,'0')}"
    }
    
    Boolean isRadioactive() {
        radioactive
    }
    
    Boolean isMagnetic() {
        magnetic
    }
    
    Boolean hasPhotographicRecord() {
        photographicRecord
    }
    
    Boolean isStored() {
        storage.getStatus()
    }
    
    Boolean isDisposed() {
        disposal.getStatus()
    }
    
    Boolean isLeftoverDisposed() {
        leftoverDisposal.getStatus()
    }
    
    public static final List STATES = ["Granulado", "Roca", "Líquido", "Polvo malla < 200 um",
                          "Filtro Teflón", "Filtro Cuarzo", "Pieza Metálica", "Plásticos"]
    
    public static final Integer DISPOSITION_METHOD_DELIVER = 0
    public static final Integer DISPOSITION_METHOD_DISPOSE = 1
    public static final List DISPOSITION_METHOD_NAMES = ["Devolver", "Disponer"]
}

